import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import {NaiveUiResolver} from 'unplugin-vue-components/resolvers'
import Compression from 'vite-plugin-compression'
import {resolve} from 'path'

export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [NaiveUiResolver()]
    }),
    Compression({
      ext: '.gz',
      deleteOriginFile: true
    })
  ],
  server: {
    host: true,
    open: true,
    hmr: {
      overlay: false
    }
  },
  resolve: {
    alias: [
      {find: '@', replacement: resolve(__dirname, 'src')},
      {find: '@c', replacement: resolve(__dirname, 'src/components')},
      {find: '@api', replacement: resolve(__dirname, 'src/axios/api')},
    ]
  },
  build: {
    reportCompressedSize: false,
    cssTarget: 'chrome61'
  }
})
